import axios from 'axios'

// 获取banner
export const getBanner = function (obj) {
  return axios.get('/api/index/slider', { params: obj })
}
// 获取文章
export const getArticle = function (obj) {
  return axios.get('/api/index/articles', { params: obj })
}
// 获取文章详情
export const getDetail = function (obj) {
  return axios.get('/api/index/article/details', { params: obj })
}

// 登录
export const login = function (obj) {
  return axios.get('/api/auth/login?url=http://localhost:3000', { params: obj })
}
// 获取个人信息
export const getInfo = function (obj) {
  return axios.get('/api/mine/info', { params: obj })
}

// 获取积分列表
export const integrals = function (obj) {
  return axios.get('/api/mine/integrals', { params: obj })
}
// 获取课程列表
export const courses = function (obj) {
  return axios.get('/api/studies/courses/lists', { params: obj })
}

// 获取活动列表
export const activity = function (obj) {
  return axios.get('/api/activity/lists', { params: obj })
}
// 获取排行
export const ranking = function (obj) {
  return axios.get('/api/activity/ranking', { params: obj })
}
// 活动详情
export const activityInfo = function (obj) {
  return axios.get('/api/activity/details', { params: obj })
}
// 我的打卡记录
export const memberRecords = function (obj) {
  return axios.get('/api/activity/member/records', { params: obj })
}
// 当前活动打卡记录
export const activityRecords = function (obj) {
  return axios.get('/api/activity/records', { params: obj })
}
// 上传视频
export const uploadVideo = function (obj) {
  return axios.post('/api/upload/video', obj, {
    headers: { "Content-Type": "multipart/form-data" }
  })
}
// 参与活动
export const create = function (obj) {
  return axios.post('/api/activity/create/record', obj)
}
// 参与活动
export const praise = function (obj) {
  return axios.post('/api/activity/create/praise', obj)
}


// 上次学习
export const oldLearn = function (obj) {
  return axios.get('/api/studies/course/last/learnt', { params: obj })
}
// 保存学习进度
export const saveRecord = function (obj) {
  return axios.post('/api/studies/learnt/record', obj)
}
// 获取课程详情
export const courseDetails = function (obj) {
  return axios.get('/api/studies/course/details', { params: obj })
}
// 获取课程评价
export const comments = function (obj) {
  return axios.get('/api/studies/course/comments', { params: obj })
}
// 添加课程评价
export const addComment = function (obj) {
  return axios.post('/api/studies/course/comment', obj)
}
// 课程目录
export const catalogues = function (obj) {
  return axios.get('/api/studies/course/catalogues', { params: obj })
}

// 作业列表
export const workList = function (obj) {
  return axios.get('/api/studies/course/works', { params: obj })
}
// 作业
export const homework = function (obj) {
  return axios.get('/api/studies/course/homework', { params: obj })
}
// 完成作业
export const answerRecord = function (obj) {
  return axios.post('/api/studies/answer/record', obj)
}
// 获取配置信息
export const getConfig = function (obj) {
  return axios.get('/api/wechat/jssdk', { params: obj })
}
// 搜索课程
export const search = function (obj) {
  return axios.get('/api/index/search', { params: obj })
}
// 课程统计
export const progressed = function (obj) {
  return axios.get('/api/studies/progressed', { params: obj })
}
// 作业
export const subject = function (obj) {
  return axios.get('/api/studies/works/lists', { params: obj })
}

// 权限控制
export const auth = function (obj) {
  return axios.get('/api/mine/authorities', { params: obj })
}
// 获取提示
export const tips = function (obj) {
  return axios.get('/api/index/site', { params: obj })
}
